<template>
	<view class="index_content_basic">
		<view class="index_content_basic_main">
			<u--form :model="ruleForm" :rules="rules" label-position="top" ref="ruleForm" label-width="100px" class="demo-ruleForm">
				 <u-form-item label="期望工作性质" prop="lookingForwardNatureWork">
				 	<!-- <el-select v-model="ruleForm.lookingForwardNatureWork" placeholder="请选择期望工作性质" style="width: 100%;">
				 		<el-option v-for="item in lookingForwardNatureWorkOption" :label="item.dictLabel" :value="item.dictValue">
				 		</el-option>
				 	</el-select> -->
					<mySelect :dict="'position_nature'" :value="ruleForm.lookingForwardNatureWork" :keys="'lookingForwardNatureWork'" @mySelectclick="mySelectclick"></mySelect>
				 </u-form-item>
				 <u-form-item label="期望从事行业" prop="lookingForwardIndustry">
					 <mySelect :dict="'company_industry'" :value="ruleForm.lookingForwardIndustry" :keys="'lookingForwardIndustry'" @mySelectclick="mySelectclick"></mySelect>
				 	<!-- <el-select v-model="ruleForm.lookingForwardIndustry" placeholder="请选择期望从事行业" style="width: 100%;">
				 		<el-option v-for="item in lookingForwardIndustryOption" :label="item.dictLabel" :value="item.dictValue">
				 		</el-option>
				 	</el-select> -->
				 </u-form-item>
				 <u-form-item label="期望薪资" prop="lookingForwardSalary">
					 <mySelect :dict="'salary'" :value="ruleForm.lookingForwardSalary" :keys="'lookingForwardSalary'" @mySelectclick="mySelectclick"></mySelect>
				 	<!-- <el-select v-model="ruleForm.lookingForwardSalary" placeholder="请选择期望薪资" style="width: 100%;">
				 		<el-option v-for="item in lookingForwardSalaryOption" :label="item.dictLabel" :value="item.dictValue">
				 		</el-option>
				 	</el-select> -->
				 </u-form-item>
				<!-- <u-form-item label="期望工作城市" prop="">
				 	<el-input v-model="ruleForm.idNumber" placeholder="请输入期望工作城市"></el-input>
				 </u-form-item> -->
				 <u-form-item label="求职状态" prop="jobSearchStatus">
					 <mySelect :dict="'status_of_job_hunting'" :value="ruleForm.jobSearchStatus" :keys="'jobSearchStatus'" @mySelectclick="mySelectclick"></mySelect>
				 	<!-- <el-select v-model="ruleForm.jobSearchStatus" placeholder="请选择期望求职状态" style="width: 100%;">
				 		<el-option v-for="item in jobSearchStatusOption" :label="item.dictLabel" :value="item.dictValue">
				 		</el-option>
				 	</el-select> -->
				 </u-form-item>
				 <u-form-item label="到岗时间" prop="arrivalTime">
					 <mySelect :dict="'arrival_time'" :value="ruleForm.arrivalTime" :keys="'arrivalTime'" @mySelectclick="mySelectclick"></mySelect>
				  <!-- <el-select v-model="ruleForm.arrivalTime" placeholder="请选择期望求职状态" style="width: 100%;">
				  	<el-option v-for="item in arrivalTimeOption" :label="item.dictLabel" :value="item.dictValue">
				  	</el-option>
				  </el-select> -->
				 </u-form-item>
			</u--form>
		</view>
		<view class="position_footer flex aic jcsb">
			<u-button class="blue_btn" style="width: 100%;" type="primary" @click="submitForm('ruleForm')">保存</u-button>
		</view>
	</view>
</template>

<script>
	import {
		editResume
	} from "@/api/my.js"
	import mySelect from "../../../components/mySelect.vue"
	export default {
		components:{
			mySelect
		},
		data() {
			return {
				ruleForm: {
					performanceRewardsPunishments:"",
					selfEvaluation: '',
					fullName: "",
					gender:"",
					photoUrl:"",
					politicalOutlook:"",
					keyPopulationInformation:"",
					obeyAdjustment:"",
					currentAddress:"",
					currentWorkUnit:"",
					currentAnnualSalary:"",
					phoneNumber:"",
					idNumber:"",
					brithDay:"",
					age:"",
					startWorkTime:"",
					marriage:"",
					health:"",
					lookingForwardNatureWork:"",
					lookingForwardIndustry:"",
					lookingForwardSalary:"",
					jobSearchStatus:"",
					arrivalTime:""
				},
				rules: {
					lookingForwardNatureWork: [{
							required: true,
							message: '请选择期望工作性质',
							trigger: 'blur'
						}
					],
					lookingForwardIndustry: [{
							required: true,
							message: '请选择期望从事行业',
							trigger: 'blur'
						}
					],
					lookingForwardSalary: [{
							required: true,
							message: '请选择期望薪资',
							trigger: 'blur'
						}
					],
					jobSearchStatus: [{
							required: true,
							message: '请选择求职状态',
							trigger: 'blur'
						}
					],
					arrivalTime: [{
							required: true,
							message: '请选择到岗时间',
							trigger: 'blur'
						}
					],
				},
				arrivalTimeOption:[]
			};
		},
		onLoad(options) {
			// this.arrivalTimeOption = uni.getStorageSync("arrival_time")
			// this.lookingForwardNatureWorkOption = uni.getStorageSync("position_nature")
			// this.lookingForwardIndustryOption = uni.getStorageSync("company_industry")
			// this.lookingForwardSalaryOption = uni.getStorageSync("salary")
			// this.jobSearchStatusOption = uni.getStorageSync("status_of_job_hunting")
			this.datas = JSON.parse(options.data)
			this.info(this.datas)
		},
		methods: {
			mySelectclick(e){
				console.log("下拉框组件回传:",e);
				this.ruleForm[e.key]=e.value
			},
			info(data) {
				console.log("data:",data);	
				this.ruleForm = data.personalInformation?data.personalInformation:this.ruleForm
			},
			submitForm(formName) {
				this.$refs.ruleForm.validate().then(valid => {
					if (valid) {
						let obj = this.datas
						console.log(obj);
						obj.personalInformation = this.ruleForm
						editResume(obj)
					} else {
						uni.showToast({
							title: "请完善信息",
							icon: 'error'
						})
						console.log('error submit!!');
						return false;
					}
				});
			},
			resetForm(formName) {
				this.$refs[formName].resetFields();
			}
		}
	}
</script>

<style lang="scss" scoped>
	.blue_btn {
		height: 40px;
		background: #2F6CBC;
		border: 1px solid #2F6CBC;
	}

</style>
